// HSS.Logging.ILogServer.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       ILogServer.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Logging
{
	#region Using Directives
	using System;
	using System.Collections.Generic;
	using System.ServiceModel;
	#endregion

	/// <summary>
	/// The Interface for a LogServer
	/// </summary>
	[ServiceContract(Namespace = "http://highspeed-solutions.net/Logging/v100")]
	public interface ILogServer : ILog
	{
		/// <summary>
		/// A method a client object can call to validate the server object exist
		/// </summary>
		/// <returns>true</returns>
		[OperationContract]
		bool Ping();

		/// <summary>
		/// Gets the current EventLogType.
		/// </summary>
		/// <returns>The <see cref="EventLogType"/>.</returns>
		[OperationContract]
		EventLogType GetLogType();

		/// <summary>
		/// Set the Log Configuration for the instance
		/// </summary>
		/// <param name="id">The unique Id for this Configuration</param>
		/// <param name="name">The friendly name for this Configuration</param>
		/// <param name="logType">The Type of log to write event entries to</param>
		/// <param name="autoTruncate">Indicate whether or not to auto truncate the eventlog</param>
		/// <param name="truncateAt">If AutoTruncate is true indicates the time of day in which to execute the Truncate Command</param>
		/// <param name="daysToRetain">If AutoTruncate is true indicates the number of days to retain</param>
		/// <param name="dbConnString">The Id of the Database Configuration to use</param>
		[OperationContract]
		void SetConfig(string id, string name, int logType, bool autoTruncate, DateTime truncateAt, int daysToRetain, string dbConnString);

		/// <summary>
		/// Returns an EventLog Configuration
		/// </summary>
		/// <returns>An EventLog Configuration</returns>
		[OperationContract]
		LogConfiguration GetConfig();

		/// <summary>
		/// Validate the database connection for event logging
		/// </summary>
		/// <param name="verbose">Indicate if the results are to be displayed</param>
		/// <returns>The <see cref="HSS.Logging.ValidationResults"/> instance contain the results</returns>
		[OperationContract]
		ValidationResults ValidateDbConnection(bool verbose);

		/// <summary>
		/// Gets a filtered list of entries from the HSS Database EventLog table.
		/// </summary>
		/// <param name="pages">Reference to the number of pages.</param>
		/// <param name="page">The desired page.</param>
		/// <param name="recPerPage">The number of records per page.</param>
		/// <param name="eventTypeMask">The Mask of EventTypes to filter for.</param>
		/// <param name="applicationName">The Application to filter for.</param>
		/// <param name="referenceNumber">The Reference Number to filter for.</param>
		/// <param name="category">The category to filter for.</param>
		/// <param name="userName">The UserName associated with the entry.</param>
		/// <param name="beginDate">The Created Date of the entry must be greater than or equal to this date.</param>
		/// <param name="endDate">The Created Date of the entry must be less than or equal to this date.</param>
		/// <returns>A list of LogRecords containing the EventLog data.</returns>
		[OperationContract]
		List<LogRecord> GetEntries(ref int pages, int page, int recPerPage, int eventTypeMask, string applicationName, string referenceNumber, string category, string userName, DateTime beginDate, DateTime endDate);

		/// <summary>
		/// Retrieve the list of Categories from the Database.
		/// </summary>
		/// <returns>A List of <see cref="LogCategory"/> objects.</returns>
		[OperationContract]
		List<LogCategory> GetCategories();

		/// <summary>
		/// Retrieve the list of Event Types from the Database.
		/// </summary>
		/// <returns>A List of <see cref="LogEventType"/> objects.</returns>
		[OperationContract]
		List<LogEventType> GetEventTypes();

		/// <summary>
		/// Retrieve an Attachment from the Database
		/// </summary>
		/// <param name="attachmentId">The id of the attachment to retrieve</param>
		/// <returns>A <see cref="HSS.Logging.LogEntryAttachment"/></returns>
		[OperationContract]
		LogEntryAttachment GetAttachment(int attachmentId);
	}
}